package com.woniuxy.io.dir;

import java.io.File;

/**
 * description: DirDemo02 <br>
 * date: 2022/2/4 9:57 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */
public class DirDemo04 {

    public static void main(String[] args) {
        File src = new File("/Users/shesaifei/Downloads/sringboot-vue01");
        printName(src, 0);
    }

    //打印1-10的数
    public static void printName(File src, int deep) {
        for (int i = 0; i < deep; i++) {
            System.out.print("-");
        }
        System.out.println(src.getName());
        if (null == src || !src.exists()) {
            return;

        } else if (src.isDirectory()) {
            for (File files : src.listFiles()) {
                printName(files, deep + 1);
            }
        }
    }
}
